#include "timeClickCnt.h"

TimeClickCnt::TimeClickCnt(/* args */)
{
}

TimeClickCnt::~TimeClickCnt()
{
}

void TimeClickCnt::startCnt()
{
    gettimeofday(&tv_, NULL);
    has_start_ = true;

}

double TimeClickCnt::stopCnt()
{
    if(!has_start_){
        printf("Please start your cnt!!!\n");
        return 0.0;
    }
    struct timeval tv1;
    gettimeofday(&tv1, NULL);
    double dura;
    dura = (tv1.tv_sec - tv_.tv_sec) * 1000.0 + (tv1.tv_usec - tv_.tv_usec)/1000.0;
    // printf("======================\n");
    // printf("duration: %9.4lfms\n", dura); 
    // printf("======================\n"); 
    return dura;
}
